﻿using System;

using ApproveFlowEngine.Core.Base;
using ApproveFlowEngine.Enums.Core;

namespace ApproveFlowEngine.Core.Nodes
{
    public class WorkNodeParallel : WorkNodeComplex
    {
        #region Public Constructors

        public WorkNodeParallel(Guid id) : base(id)
        {
            NodeType = NodeType.Parallel;
        }

        #endregion Public Constructors



        #region Protected Constructors

        protected WorkNodeParallel()
        {
            NodeType = NodeType.Parallel;
        }

        #endregion Protected Constructors



        #region Public Properties

        public override ApproveNodeStatus Status
        {
            get
            {
                if (PassCount > 0)
                {
                    return ApproveNodeStatus.Pass;
                }
                if (NoneCount == Children.Count)
                {
                    return ApproveNodeStatus.None;
                }
                if (RejectCount > 1)
                {
                    return ApproveNodeStatus.Reject;
                }
                return ApproveNodeStatus.Activity;
            }
        }

        #endregion Public Properties
    }
}